package com.mirror.llk.dao.impl;

import org.springframework.stereotype.Repository;

import com.mirror.frame.dao.BaseDao;
import com.mirror.llk.bean.domain.TUser;
import com.mirror.llk.dao.UserDao;

@Repository
public class UserDaoDaoImpl extends BaseDao implements UserDao {

    @Override
    public Long saveUser(TUser user) {
        Long id = null;
        Object userId = this.getSqlMapClientTemplate().queryForObject("com.mirror.llk.queryIdByOpenId", user);
        if (user != null) {
            id = (Long) userId;
        } else {
            id = (Long) this.getSqlMapClientTemplate().insert("com.mirror.llk.saveUser", user);
        }
        return id;
    }
}
